﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace STS
{
    public partial class kwalfikacja : System.Web.UI.Page
    {

        baza db = new baza();
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.FindControl("NavigationMenuR").Visible = false;
            if (Main.idpacjenta == 0)
            {
                tekst.Text = "Wybierz pacjenta!";
                tekst.Visible = true;
                //DropDownList1.Visible = false;
                //Button1.Visible = false;
                Panel1.Visible = false;
            }
            else
            {

                id_pacjenta.Text = Main.idpacjenta.ToString();
                Panel1.Visible = true;
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Button4.Visible = true;
            Button5.Visible = true;
            Button6.Visible = true;
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            var ud = db.dane_pacjentows.SingleOrDefault(fbu => fbu.id_pacjenta == Convert.ToInt32(id_pacjenta.Text));
            ud.stan = 0;
            db.SubmitChanges();
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            var ud = db.dane_pacjentows.SingleOrDefault(fbu => fbu.id_pacjenta == Convert.ToInt32(id_pacjenta.Text));
            ud.stan = 2;
            db.SubmitChanges();
        }

        protected void Button6_Click(object sender, EventArgs e)
        {
            var ud = db.dane_pacjentows.SingleOrDefault(fbu => fbu.id_pacjenta == Convert.ToInt32(id_pacjenta.Text));
            ud.stan = 1;
            
            db.SubmitChanges();
        }

        protected void Button7_Click(object sender, EventArgs e)
        {
            var ud = db.dane_pacjentows.SingleOrDefault(fbu => fbu.id_pacjenta == Convert.ToInt32(id_pacjenta.Text));
            if (bezdializ.Checked)
            {
                ud.bez_dializ = 't';
            }
            else
            {
                ud.bez_dializ = 'n';
            }
            if (cukryca.Checked)
            {
                ud.cukrzyca = 't';
            }
            else
            {
                ud.cukrzyca = 'n';
            }
            if (innynarzad.Checked)
            {
                ud.inny_narzad = 't';
            }
            else
            {
                ud.inny_narzad = 'n';
            }
            if (pomiesiacu.Checked)
            {
                ud.utrata = 't';
            }
            else
            {
                ud.utrata = 'n';
            }
            db.SubmitChanges();

        }

    }
}